
import { createApp,ref } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'
import ViewUIPlus from 'view-ui-plus'
import 'view-ui-plus/dist/styles/viewuiplus.css'
// import 'monaco-editor/esm/vs/editor/editor.main.css';
import '@/assets/css/style.scss'
import '@/assets/css/my-base.css'
import '@/assets/css/base-info.css'

import config from '@/config'
const app = createApp(App)


const MyDynamicComponent = {
    name: 'MyDynamicComponent',
    props: {
        componentName: {
            type: String,
            required: true
        }
    },
    setup(props) {
        const Component = ref(null)

        // 使用 watchEffect 来监听 componentName 的变化，并动态地加载组件
        import(`./module-chrome/views/format/${props.componentName}.vue`).then(module => {
            Component.value = module.default
        })

        return {
            Component
        }
    },
    // render() {
    //     return <Component></Component>
    // }
}

app.component('MyDynamicComponent', MyDynamicComponent)

app.use(createPinia())
app.use(router)
app.use(ViewUIPlus)
app.config.globalProperties.$config = config
app.mount('#app')
